﻿$(document).ready(function(){
	
	
	/**** 20120111 add ***/
	var yingyuan_top = $("#selcinemalch").offset().top;
	var yingyuanlist_h = $("#cinemasearchnew").height();
	//alert(yingyuanlist_h);
	/*** 20120111 end ***/
    /*** top pageTop ******/

    var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
		.text($backToTopTxt).attr("title", $backToTopTxt).click(function() {
			$("html, body").animate({ scrollTop: 0 }, 120);
	}), $backToTopFun = function() {
		var st = $(document).scrollTop(), winh = $(window).height();
		(st > 0)? $backToTopEle.show(): $backToTopEle.hide();	
		//IE6下的定位
		if (!window.XMLHttpRequest) {
			$backToTopEle.css("top", st + winh - 66);	
		}
	};
	$(window).bind("scroll", $backToTopFun);
	$(function() { $backToTopFun(); });
	
  kchangecity2(cid);

  $("#selmovielch").mouseover(function(){
     $("#kchfilmname").addClass("newselh");
	   $("#kchfilmname > b").addClass("newselhb");
	   $("#moviesearchnew").show().removeClass("topsel-movieB").addClass("xlsel-movie_2");
	   
		if($("#tip").length>0){
			$("#kfilm").remove("#tip");
		}else{
			$("#kfilm").prepend("<div id='tip' style='font-size:12px;color:#369;'>正在上映的影片：</div>");
		}
		$("#kfilm>li>a:eq(1)").css("background","none").css("position","absolute").css("top","0").css("right","-15px");
		$("#kfilm>li").css("margin-right","25px");
	   $("#ktimesearchnew").hide();
	   $("#cinemasearchnew").hide();		  
	  });
$("#selmovielch").mouseout(function(){
		$("#kchfilmname").removeClass("newselh");
		$("#kchfilmname > b").removeClass("newselhb");						
	   $("#moviesearchnew").hide();	   
	  });
$("#selcinemalch").mouseover(function(){
        $("#kchcinemaname").addClass("newselh");
		$("#kchcinemaname > b").addClass("newselhb");
	   $("#cinemasearchnew").show();
	   $("#moviesearchnew").hide();
	   $("#ktimesearchnew").hide();
	   	if($("#tips").length>0){
			$("#kcinema").remove("#tips");
		}else{
			$("#kcinema").prepend("<div id='tips' style='font-size:12px;color:#369;'>请选择您的影院：</div>");
		}
		$("#kcinema>li>span>a:eq(1)").css("position","absolute").css("top","2px").css("right","-25px");
		$("#kcinema>li>span").css("margin-right","25px");
	  });
$("#selcinemalch").mouseout(function(){
		$("#kchcinemaname").removeClass("newselh");
		$("#kchcinemaname > b").removeClass("newselhb");
	   $("#cinemasearchnew").hide();
	  });
	  $("#seltimelch").mouseout(function(){
		$("#kchshowname").removeClass("newselh");
		$("#kchshowname > b").removeClass("newselhb");
	   $("#ktimesearchnew").hide();
	  });kchangefilm2(cid); kchangecinema2(cid);
	  
	  $("#seltimelch").mouseover(function(){
		
if($("#kchfilmname").html()=='选择影片'&&$("#kchcinemaname").html()=='选择影院')
       {
          $("#noteid").html("请先选择影片或影院");
       }
       if($("#kchfilmname").html()=='选择影片'&&$("#kchcinemaname").html()!='选择影院')
       {
          $("#noteid").html("你还没选择影片");
       }
       if($("#kchfilmname").html()!='选择影片'&&$("#kchcinemaname").html()=='选择影院')
       {
          $("#noteid").html("你还没选择影院");
       }
	   $("#kchshowname").addClass("newselh");
		$("#kchshowname > b").addClass("newselhb");
	   $("#ktimesearchnew").show();
	   $("#cinemasearchnew").hide();
	   $("#moviesearchnew").hide();
	  });
	  
	  /***** 20110909 *****/
  $("#test_id").hover(function(){ //选择影片的
  	$(this).parent().parent().eq(1).show();
  },
  function(){
  	$(this).parent().parent().eq(1).hide();
  })
  
  $("#test_id2").hover(function(){ //选择影院的
  	$(this).parent().parent().eq(1).show();
  },
  function(){
  	$(this).parent().parent().eq(1).hide();
  })
  
  $("#today").hover(function(){ //电影时间的
  	$(this).eq(0).show();
  },function(){
  	$(this).eq(0).hide();
  })
	/***** 20110909 end *****/
	
	$("#selmovielch").hover(function(){
		$("#kchfilmname").css("z-index","1002");
	},function(){
		$("#kchfilmname").css("z-index","1");
	})
	
	$("#selcinemalch").hover(function(){
		$("#kchcinemaname").css("z-index","1001");
	},function(){
		$("#kchcinemaname").css("z-index","1");
	})
	
	$("#ktimesearchnew").hover(function(){
		$("#kchshowname").css("z-index","0");
	},function(){
		$("#kchshowname").css("z-index","1001");
	})
	
	$("#selmovielch").hover(function(){
		$(".searlvideo_input").css("z-index","99999");
	},function(){
		$(".searlvideo_input").css("z-index","0");
	})
	
})
function showxiaoguo()
{
	/***** 20110909 *****/
	$(".topic").hover(function(){ //选择影片的
		$(this).parent().next().show();
	},function(event){
		$(this).parent().next().hide();
		event.stopPropagation();
	})
  
  
  $(".today").hover(function(){ //电影时间的
	$(this).children().show();
  },function(){
	$(this).children().hide();
  })
	/***** 20110909 *****/


}
function kchangeshow(kfilmid,kcinemaid,kcinemaname)
{   $("#kshow").html("正在加载");
    $("#kchcinemaname").html(kcinemaname);
    $("#cinemasearchnew").hide();
    $.ajax({type:'POST',url:'/Users/indexsearchyin.aspx',data:{"kcinemaid":kcinemaid,"kfilmid":kfilmid,"sort":"3"},
            success:function(data){
              if(data!="-1")
              {
                 $("#kshow").html(data);
                 showxiaoguo();
              }
    }
    });
    //$("#ktimesearchnew").show();
}
function kshowfilmofcinema(cinemaindex,cinemaname)
{   $("#kshow").html("请先选择影片");
    $("#kchfilmname").html('选择影片');
    $("#kchcinemaname").html(cinemaname);
    $("#cinemasearchnew").hide();
    $("#kfilm").html("");
    $.ajax({type:'POST',url:'/Users/indexsearchyin.aspx',data:{"cinemaindex":cinemaindex,"sort":"5"},
            success:function(data){
              if(data!="-1")
              {
                 $("#kfilm").html(data);
                 showxiaoguo();
              }
    }
    });
    //$("#moviesearchnew").show();
}

function kchangecinema(kcityid,kfilmid,kfilmname)
{   $("#kshow").html("请先选择影院");
$("#kchcinemaname").html('选择影院');
    $("#kcinema").html("");
    //$("#cinemasearchnew").show();
    $("#kchfilmname").html(kfilmname);
    $("#moviesearchnew").hide();
    
    $.ajax({type:'POST',url:'/Users/indexsearchyin.aspx',data:{"kcityid":kcityid,"kfilmid":kfilmid,"sort":"2"},
            success:function(data){
              if(data!="-1")
              {
                 $("#kcinema").html(data);
                 showxiaoguo();
              }
    }
    });
    
}

function kchangeshow2(kfilmid,kcinemaid,kfilmname)
{   $("#kshow").html("正在加载");
    $("#kchfilmname").html(kfilmname);
    $("#moviesearchnew").hide();
    $.ajax({type:'POST',url:'/Users/indexsearchyin.aspx',data:{"kcinemaid":kcinemaid,"kfilmid":kfilmid,"sort":"3"},
            success:function(data){
              if(data!="-1")
              {
                 $("#kshow").html(data);
                 showxiaoguo();
              }
    }
    });
    //$("#ktimesearchnew").show();
}
function kchangecinema2(kcityid)
{   $("#kcinema").html("");
    
    
    
    
    $.ajax({type:'POST',url:'/Users/indexsearchyin.aspx',data:{"kcityid":kcityid,"sort":"4"},
            success:function(data){
              if(data!="-1")
              {
                 $("#kcinema").html(data);
                 showxiaoguo();
              }
    }
    });
    
}

function kchangefilm2(kcityid)
{
    $("#kfilm").html("");
    $.ajax({type:'POST',url:'/Users/indexsearchyin.aspx',data:{"kcityid":kcityid,"sort":"1"},
            success:function(data){
              if(data!="-1")
              {
                 $("#kfilm").html(data);
                 showxiaoguo();
              }
    }
    });
    
}
function kchangecity2(kcityid)
{  var kcityn="北京";
   switch(kcityid)
		{
		   case "1":
		   kcityn="北京";
		   break;
		   case "2":
		   kcityn="上海";
		   break;
		   case "3":
		   kcityn="深圳";
		   break;
		   case "4":
		   kcityn="广州";
		   break;
		   case "5":
		   kcityn="武汉";
		   break;
		   case "6":
		   kcityn="杭州";
		   break;
		   case "7":
		   kcityn="昆明";
		   break;
		   case "8":
		   kcityn="天津";
		   break;
		   case "10":
		   kcityn="佛山";
		   break;
		   case "9":
		   kcityn="重庆";
		   break;
		   case "11":
		   kcityn="郑州";
		   break;
		   
		   case "12":
		   kcityn="西安";
		   break;
		   case "15":
		   kcityn="石家庄";
		   break;
		   case "16":
		   kcityn="成都";
		   break;
		   case "18":
		   kcityn="十堰";
		   break;
		   case "19":
		   kcityn="沈阳";
		   break;
		   case "17":
		   kcityn="南京";
		   break;
           case "14":
		   kcityn="青岛";
		   break;
		   case "23":
		   kcityn="绍兴";
		   break;
		   case "22":
		   kcityn="唐山";
		   break;
		   case "37":
		   kcityn="仪征";
		   break;
		   case "38":
		   kcityn="清远";
		   break;
		   case "39":
		   kcityn="厦门";
		   break;
		   case "24":
		   kcityn="东莞";
		   break;
		   case "25":
		   kcityn="苏州";
		   break;
		   case "40":
		   kcityn="福州";
		   break;
		}
	$("#yinchangecity2").html(kcityn+"[更换城市]");	
	
}
